//
//  NSData+DataConvert.h
//  OutdoorAssistantApplication
//
//  Created by 罗亮富 on 15/9/25.
//  Copyright © 2015年 Lolaage. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "LAGTypes.h"
#import <CoreLocation/CoreLocation.h>



#pragma mark-NSMutableData (LolaageIMPackage)

@interface  NSMutableData (LolaageIMPackage)


-(void)addByteData:(U8)byteVal;
-(void)addShortData:(S16)shortVal;
-(void)addIntData:(U32)intVal;
-(void)addLongData:(S64)longVal;
-(void)addFloatData:(FLOAT)floatVal;
-(void)addDoubleData:(DOUBLE)doubleVal;

//edian表示目标数据的大小端格式，而非本地的
-(void)addShortData:(S16)shortVal toEdian:(EDIAN_T)edian;
-(void)addIntData:(U32)intVal toEdian:(EDIAN_T)edian;
-(void)addLongData:(S64)longVal toEdian:(EDIAN_T)edian;
-(void)addFloatData:(FLOAT)floatVal toEdian:(EDIAN_T)edian;
-(void)addDoubleData:(DOUBLE)doubleVal toEdian:(EDIAN_T)edian;


-(void)addCoordinateData:(CLLocationCoordinate2D)coordinate;
//添加long 的number 数组
-(void)addLongNumberArray:(NSArray <NSNumber *> *)array;

-(U8)extractByte;

-(S16)extractShort;
-(S32)extractInt;
-(S64)extractLonglong;
-(FLOAT)extractFloat;
-(DOUBLE)extractDouble;

//edian表示数据源(这里即NSData里)数据的大小端格式，而非本地的
-(S16)extractShortFromEdian:(EDIAN_T)edian;
-(S32)extractIntFromEdian:(EDIAN_T)edian;
-(S64)extractLonglongFromEdian:(EDIAN_T)edian;
-(FLOAT)extractFloatFromEdian:(EDIAN_T)edian;
-(DOUBLE)extractDoubleFromEdian:(EDIAN_T)edian;


-(CLLocationCoordinate2D)extractCoordinate;
-(NSData *)extractDataOfLength:(NSUInteger)len;

//-(NSArray *)extractArrayOfClass:(Class<DataExtractionProtocol>)className;
-(NSDate *)extractDate;


@end


